package org.example;

import java.io.IOException;

public class MServlet extends HttpServlet {
    @Override
    public void doGet(Request request, Response response) {
        //测试多线程，线程池
//        try {
//            Thread.sleep(9000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        System.out.println(">> doGet");
        String content = "<h1>doGet</h1>";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200() + content);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    @Override
    public void doPost(Request request, Response response) {
        System.out.println(">> doPost");
        String content = "<h1>doPost</h1>";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200() + content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {
        System.out.println(">> init");
    }

    @Override
    public void destory() throws Exception {
        System.out.println(">> destory");
    }
}
